package mmc.server.shell.ops.utility;

import java.lang.reflect.Field;

import mmc.Constants;
import mmc.server.shell.*;
import mmc.server.shell.ops.Constant;

public class EngineConstant extends Constant {

	private Field field;
	
    public EngineConstant(String text) throws ShellException {
    	super(text);
        try {
            field = Constants.class.getField(text.toUpperCase());
        } catch (Exception e) {
            throw new OperationNotAcceptedException(false, "No value: " + e.getMessage());
        }
    }

    @Override
    public double execute() {
    	return Util.getField(field, null);
    }
    
    public static String getDescription(){
    	return formatHelpString("Constant","static field of "+Constants.class.getName());
    }
}
